<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%@ include file="/WEB-INF/page/include.inc.jsp"%>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Insert title here</title>
	<script>
		$(document).ready(function() {
			validate();
		});
		
		function validate() {
			meta:"validate",
			$("#formId").validate({
				submitHandler:function(form){
					$.ajaxFileUpload({
	                    url: 'upload',
	                    data: {},
	                    fileElementId: 'uploadFile',
	                    dataType: 'JSON',
	                    success: function (data, status) {
							msgAlert('信息提示', '操作成功', 'info', function(){
								parent.refreshTab("操作员管理");
								parent.closeCurrTab();
							});
	                    },
	                    error: function (data, status, e) {
	                    	msgAlert('错误提示', data.message, 'error', null);
	                    }
	                });
		        },
			});
		}
		
		function submitForm(tabName) {
		    $("#formId").ajaxSubmit(function(data) {
		    	var obj = eval ("(" + data + ")");
		    	if (obj.success) {
					msgAlert('信息提示', '操作成功', 'info', function() {
						parent.refreshTab(tabName);
						parent.closeCurrTab();
					});
				}
				else {
					msgAlert('错误提示', obj.message, 'error', null);
				}
		    });
		}
	</script>
</head>
<body>
	<div>
        <form id="formId" name="formId" action="upload" method="post" enctype="multipart/form-data">
			<div style="padding:20px 0 10px 70px">
				<input type="file" id="uploadFile" name="uploadFile" value="aa.txt"></input>
				<input class="button" type="submit" value="提交"></input>
				<input class="button" type="button" value="取消" onclick="parent.closeCurrTab();"></input>
			</div>
        </form>
    </div>
    
    <iframe name="hideIframe" style="display:none"></iframe>
</body>
</html>
